﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

namespace Jxym.wlkc2011.Module.CMS.SERVER
{
    public partial class getTemplates : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string tpath = Server.MapPath("~/Module/CMS/resources/templates/");

                if (Directory.Exists(tpath))
                {
                    string[] tnames = Directory.GetDirectories(tpath);
                    string str = "[";
                    for (int i = 0; i < tnames.Length; i++)
                    {
                        string dname = tnames[i].Substring(tpath.LastIndexOf('\\') + 1);
                        str += "{ID:'" + dname + "',Name:'" + dname + "'},";
                    }
                    str = str.TrimEnd(',');
                    Response.Write(str + "]");
                }
            }
        }
    }
}